<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>交作业 | 重置密码</title>
  <!-- Tell the browser to be responsive to screen width -->
  <meta name="viewport" content="width=device-width, initial-scale=1">

  <!-- Font Awesome -->
  <link rel="stylesheet" href="./plugins/fontawesome-free/css/all.min.css">
  <!-- Ionicons -->
  <link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
  <!-- icheck bootstrap -->
  <link rel="stylesheet" href="./plugins/icheck-bootstrap/icheck-bootstrap.min.css">
  <!-- Theme style -->
  <link rel="stylesheet" href="./css/adminlte.min.css">
</head>

<body class="hold-transition login-page">
  <div class="login-box">
    <div class="login-logo">
      <a href="./index.html"><b>重置密码</b></a>
    </div>
    <!-- /.login-logo -->
    <div class="card">
      <div class="card-body login-card-body">
        <p class="login-box-msg">如果你忘记了密码可以重置一个新的密码，新密码会发送到你的邮箱。</p>

        <form id="resetPassword_form">
          <div class="input-group mb-3">
            <input type="text" name="userNumber" class="form-control" placeholder="账号">
            <div class="input-group-append">
              <div class="input-group-text">
                <span class="fas fa-envelope"></span>
              </div>
            </div>
          </div>
          <div class="row">
            <div class="col-12">
              <button type="button" onclick="resetPassword()" class="btn btn-primary btn-block">重置密码</button>
            </div>
            <!-- /.col -->
          </div>
        </form>

        <p class="mt-3 mb-1">
          <a href="./">登录</a>
        </p>
      </div>
      <!-- /.login-card-body -->
    </div>
  </div>
  <!-- /.login-box -->

  <!-- jQuery -->
  <script src="./plugins/jquery/jquery.min.js"></script>
  <!-- Bootstrap 4 -->
  <script src="./plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
  <!-- AdminLTE App -->
  <script src="js/adminlte.min.js"></script>
  <script src="js/myjs/utils.js"></script>
  <script src="./js/myjs/work.js"></script>
  <script>
    function resetPassword() {
      let obj = serializeJsonForm("resetPassword_form");
      _submitPost(obj, getUrl() + "/user/resetPasswordJson", function (results) {
        if (results.code == 1) {
          setToken('');
          setUser('');
          location.href = '/'
        } else {
          alert('失败');
          location.href = './forgot-password.html'
        }
      });
    }
  </script>
</body>

</html>